1. Technology Field
The present invention relates to a data writing method for a flash memory and particularly to a data writing method capable of effectively writing data into a flash memory, and a flash memory controller and a flash memory storage system using the method.
2. Description of Related Art
Flash memory is the most adaptable memories to be applied in portable electronic products which are supplied power by batteries due to its data non-volatility, low power consumption, small volume, and non-mechanical structure. For example, a solid state drive (SSD) is a storage device that uses a NAND flash memory as its storage medium, and which has been broadly used in notebook computers as the main storage device.
In general, the flash memory chip of a flash memory storage device has a plurality of physical blocks, each physical block has a plurality of physical pages, and each physical block is the erasing unit and each physical page is the programming unit. Because a flash memory chip can only be programmed (i.e., written) in a single direction (i.e., the value of a memory cell thereof can only be programmed from 1 to 0), data cannot be directly written into a physical page that has been programmed before (i.e., a physical page contains data). Instead, the page has to be erased first before it can be programmed. In particular, since a flash memory chip is erased in unit of physical blocks, when a physical page containing old data is to be erased, the entire physical block corresponding to the physical page has to be erased. Accordingly, the physical blocks of the flash memory chip are grouped into a data area and a spare area. The physical blocks in the data area are physical blocks which have stored data, and the physical blocks in the spare area are physical blocks which do not have stored data. When a host system is about to store data in the flash memory storage device, a control circuit of the flash memory storage device gets a physical block from the spare area to write-in data, and the gotten physical block is linked to the data area. And, when the physical block in the data area is erased, the erased physical block is linked to the spare area.
Additionally, the host system writes data based on logical addresses, but usually not according to the order of the logical addresses. Accordingly, when the control circuit of the flash memory storage device is about to erase a physical block, the flash memory storage will spend a lot of time to process valid data and invalid data in the entire physical block. Therefore, how to increase the speed of writing data in a flash memory is one of the major subjects in the industry.
Nothing herein should be construed as an admission of knowledge in the prior art of any portion of the present invention. Furthermore, citation or identification of any document in this application is not an admission that such document is available as prior art to the present invention, or that any reference forms a part of the common general knowledge in the art.